<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <style>
    #txt{width: 400px;height: 100px;text-align: center;font-size: 40px;}
    #btn{width: 100px;}
  </style>
</head>
<body>
  <input type="text" id="txt" value="点击按钮，开始点名" disabled>
  <input type="button" id="btn" value="开始">
</body>
<script>

  var txt = document.getElementById("txt")
  var btn = document.getElementById("btn")

  var names = ["张三", "李四", "王二", "赵五", "钱六", "孙膑", "庞娟"];

  var t;

  var state = 0;

  btn.onclick = function(){
    if(state === 0){

      if( t ) return;
      t = setInterval(function(){
        txt.value = names[random(0, names.length-1)];
      }, 50);
      state = 1;
      btn.value = "就是你！";

    }else if(state === 1){

      clearInterval(t);
      t = undefined;
      state = 0;
      btn.value = "再来一个";

    }
  }
  

  function random(max,min){
    return Math.round(Math.random()*(max-min)+min);
  }
</script>
</html>